export let getUrl = function (url) {
    let platform = WXEnvironment.platform.toLowerCase();
    if (platform === 'web') {
        url = '#/' + url
    }
    return url
};

export const setStore = function (name, content) {
    if (!name) return;
    if (typeof content !== 'string') {
        content = JSON.stringify(content);
    }
    if (!content) return;
    weex.requireModule('storage').setItem(name, content);
};

// 获取localStorage  // android版 获取数据失败
export const getStore = function (name) {
    if (!name) return;
    let value = '';
    weex.requireModule('storage').getItem (name, event =>{
        value = event.data ;
    });
    weex.requireModule('modal').toast({
        message: 'name:'+ name + 'value:'+ value
    });
    return value;
};

// 删除localStorage
export const removeStore = function (name) {
    if (!name) return;
    weex.requireModule('storage').removeItem(name);
};